package com.example.schoolnewsapp;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.os.Bundle;

import com.example.schoolnewsapp.JavaBean.news_info;
import com.example.schoolnewsapp.adapter.NewsDoubleAdapter;
import com.example.schoolnewsapp.databinding.ActivityDoubleBinding;


import java.util.ArrayList;
import java.util.List;

public class DoubleActivity extends AppCompatActivity {
    ActivityDoubleBinding binding;
    news_info News;
    List<news_info> newsList = new ArrayList<news_info>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityDoubleBinding.inflate(getLayoutInflater());

        Bundle bundle = this.getIntent().getExtras();
        News = (news_info)bundle.get("news_info");
        newsList.add(News);
        initview();

        setContentView(binding.getRoot());
    }

    private void initview() {
        binding.rvSecondpage.setLayoutManager(new LinearLayoutManager(this));
        binding.rvSecondpage.setItemAnimator(new DefaultItemAnimator());
        NewsDoubleAdapter adapter = new NewsDoubleAdapter(newsList);
        binding.rvSecondpage.setAdapter(adapter);
    }
}